﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PersonalTradingResultShort.ascx.cs"
    Inherits="TCKQKL.FrontEnd.Web.Controls.PersonalTradingResult" %>
<%@ Import Namespace="TCKQKL.FrontEnd.DataModel" %>
<%@ Import Namespace="TCKQKL.FrontEnd.Config" %>
<link href="../styles/data.css" rel="stylesheet" type="text/css" />
<% if (personal.MainTradingResult != null)
   {%>
<table class="data" style="border: none;">
    <% if (personal.MainTradingResult.TradingResults != null)
           if (personal.MainTradingResult.TradingResults.Count > 0)
           {%>
    <!-- Main orders header -->
    <tr>
        <td class="OrderAlertMessageStyle" colspan="9">
            <img alt="KẾT QUẢ GIAO DỊCH" src="./Images/transactions.gif" style="width: 51px;
                height: 34px" /><%=personal.MainTradingResult.InvestorProfile.name + " (" + personal.MainTradingResult.InvestorProfile.accountNo + ")"%>
        </td>
    </tr>
    <tr>
        <th class="InnerHeading" rowspan="2" style="text-align: center;">
            Ngày
        </th>
        <th class="InnerHeading" rowspan="2">
            Lệnh
        </th>
        <th class="InnerHeading" rowspan="2">
            Mã CK
        </th>
        <th class="InnerHeading" rowspan="2" style="border-right: 1px solid #ccc; text-align: center;">
            Loại lệnh
        </th>
        <th class="InnerHeading" colspan="2" style="text-align: center;">
            Lệnh gốc
        </th>
        <th class="InnerHeading" colspan="2" style="text-align: center;">
            Lệnh Khớp
        </th>
        <th class="InnerHeading" rowspan="2" style="border-left: 1px solid #ccc; text-align: center;">
            Giá trị
        </th>
    </tr>
    <tr>
        <th class="InnerHeading">
            KL
        </th>
        <th class="InnerHeading">
            Giá
        </th>
        <th class="InnerHeading">
            KL
        </th>
        <th class="InnerHeading">
            Giá
        </th>
    </tr>
    <%for (int i = 0; i < personal.MainTradingResult.TradingResults.Count; i++)
      { %>
    <!-- Main orders detail -->
    <tr>
        <td class="InnerData">
            <%=personal.MainTradingResult.TradingResults[i].RootOrder.openDate.ToString("dd/MM/yyyy")%>
        </td>
        <td class="InnerData">
            <%=personal.MainTradingResult.TradingResults[i].RootOrder.OrderSide%>
        </td>
        <td class="InnerData">
            <%=personal.MainTradingResult.TradingResults[i].RootOrder.symbol%>
        </td>
        <td class="InnerData">
            <%=personal.MainTradingResult.TradingResults[i].RootOrder.OrderClass%>
        </td>
        <td class="InnerData" style="text-align: right">
            <%=String.Format("{0:0,0}", personal.MainTradingResult.TradingResults[i].RootOrder.quantity)%>
        </td>
        <td style="text-align: right">
            <%=String.Format("{0:0,0}", personal.MainTradingResult.TradingResults[i].RootOrder.price)%>
        </td>
        <td class="InnerData" style="text-align: right; color: green">
            <%=(personal.MainTradingResult.TradingResults[i].SubQtty != 0) ?String.Format("{0:0,0}", personal.MainTradingResult.TradingResults[i].SubQtty):"-"%>
        </td>
        <td class="InnerData" style="text-align: right; color: green">
            <%=(personal.MainTradingResult.TradingResults[i].SubQtty != 0) ? ((personal.MainTradingResult.TradingResults[i].Side.Trim() == "Mua")? String.Format("{0:0,0}", ((personal.MainTradingResult.TradingResults[i].SubValue - personal.MainTradingResult.TradingResults[i].FeeAmount) / personal.MainTradingResult.TradingResults[i].SubQtty)):String.Format("{0:0,0}", ((personal.MainTradingResult.TradingResults[i].SubValue + personal.MainTradingResult.TradingResults[i].FeeAmount) / personal.MainTradingResult.TradingResults[i].SubQtty))) : "-"%>
        </td>
        <td class="InnerData" style="text-align: right">
            <span title="<%=personal.MainTradingResult.TradingResults[i].FeeAmount %>">
                <%=(personal.MainTradingResult.TradingResults[i].SubQtty != 0) ? String.Format("{0:0,0}",personal.MainTradingResult.TradingResults[i].SubValue) : "-" %>
            </span>
        </td>
    </tr>
    <%if (personal.MainTradingResult.TradingResults[i].RelatedOrders != null)
          if (personal.MainTradingResult.TradingResults[i].RelatedOrders.Count > 0)
          {%>
    <%}%>
    <%if (personal.MainTradingResult.TradingResults[i].DetailMatched != null)
          if (personal.MainTradingResult.TradingResults[i].DetailMatched.Count > 0)
          {%>
    <%}%>
    <%}%>
    <%}%>
</table>
<%} %>
<% if (personal.AssignTradingResult != null)
       if (personal.AssignTradingResult.Count > 0)
           foreach (TotalTradingResultUI assign in personal.AssignTradingResult)
           {%>
<% if (assign.TradingResults != null)
       if (assign.TradingResults.Count > 0)
       {%>
<br />
<table class="data" style="border: none;">
    <!-- Main orders header -->
    <tr>
        <td class="Master" colspan="9">
            <img alt="KẾT QUẢ GIAO DỊCH" src="./Images/transactions.gif" style="width: 51px;
                height: 34px" /><%=assign.InvestorProfile.name + " (" + assign.InvestorProfile.accountNo + ")" %>
        </td>
    </tr>
    <tr>
        <th class="InnerHeading" rowspan="2" style="text-align: center;">
            Ngày
        </th>
        <th class="InnerHeading" rowspan="2">
            Lệnh
        </th>
        <th class="InnerHeading" rowspan="2">
            Mã CK
        </th>
        <th class="InnerHeading" rowspan="2" style="text-align: center; border-right: 1px solid #ccc;">
            Loại lệnh
        </th>
        <th class="InnerHeading" colspan="2" style="text-align: center;">
            Lệnh gốc
        </th>
        <th class="InnerHeading" colspan="2" style="text-align: center;">
            Lệnh khớp
        </th>
        <th class="InnerHeading" rowspan="2" style="text-align: center; border-left: 1px solid #ccc;">
            Giá trị
        </th>
    </tr>
    <tr>
        <th class="InnerHeading">
            KL
        </th>
        <th class="InnerHeading">
            Giá
        </th>
        <th class="InnerHeading">
            KL
        </th>
        <th class="InnerHeading">
            Giá
        </th>
    </tr>
    <%for (int i = 0; i < assign.TradingResults.Count; i++)
      { %>
    <!-- Main orders detail -->
    <tr>
        <td class="InnerData">
            <%=assign.TradingResults[i].RootOrder.openDate.ToString("dd/MM/yyyy")%>
        </td>
        <td class="InnerData">
            <%=assign.TradingResults[i].RootOrder.OrderSide%>
        </td>
        <td class="InnerData">
            <%=assign.TradingResults[i].RootOrder.symbol%>
        </td>
        <td class="InnerData">
            <%=assign.TradingResults[i].RootOrder.OrderClass%>
        </td>
        <td class="InnerData">
            <%=String.Format("{0:0,0}", assign.TradingResults[i].RootOrder.quantity)%>
        </td>
        <td class="InnerData">
            <%=String.Format("{0:0,0}", assign.TradingResults[i].RootOrder.price)%>
        </td>
        <td class="InnerData" style="text-align: right; color: green">
            <%=(assign.TradingResults[i].SubQtty != 0) ? String.Format("{0:0,0}", assign.TradingResults[i].SubQtty) : "-"%>
        </td>
        <td class="InnerData" style="text-align: right; color: green">
            <%=(assign.TradingResults[i].SubQtty != 0) ? ((assign.TradingResults[i].Side.Trim() == "Mua")?String.Format("{0:0,0}", ((assign.TradingResults[i].SubValue - assign.TradingResults[i].FeeAmount) / assign.TradingResults[i].SubQtty)):String.Format("{0:0,0}", ((assign.TradingResults[i].SubValue + assign.TradingResults[i].FeeAmount) / assign.TradingResults[i].SubQtty))) : "-"%>
        </td>
        <td class="InnerData" style="text-align: right">
            <span title="<%=assign.TradingResults[i].FeeAmount %>">
                <%=(assign.TradingResults[i].SubQtty != 0) ? String.Format("{0:0,0}", assign.TradingResults[i].SubValue) : "-" %>
            </span>
        </td>
    </tr>
    <%if (assign.TradingResults[i].RelatedOrders != null)
          if (assign.TradingResults[i].RelatedOrders.Count > 0)
          {%>
    <%}%>
    <%if (assign.TradingResults[i].DetailMatched != null)
          if (assign.TradingResults[i].DetailMatched.Count > 0)
          {%>
    <%}%>
    <%}%>
</table>
<br />
<%}%><%} %>